package edu.lsnu.equipment_management_system.service.impl;

import edu.lsnu.equipment_management_system.exception.NoPowerException;
import edu.lsnu.equipment_management_system.mapper.select.nopaging.EquipmentInformationMapper;
import edu.lsnu.equipment_management_system.mapper.select.nopaging.PowerCheckMapper;
import edu.lsnu.equipment_management_system.mapper.select.paging.EquipmentInformationMapperWithPaging;
import edu.lsnu.equipment_management_system.pojo.domain.PageBean;
import edu.lsnu.equipment_management_system.pojo.domain.PageBeanDeal;
import edu.lsnu.equipment_management_system.pojo.vo.out.admin.AdminMsgInVo;
import edu.lsnu.equipment_management_system.pojo.vo.out.admin.AdminUseRecordVo;
import edu.lsnu.equipment_management_system.pojo.vo.out.information_list.UseRecordVo;
import edu.lsnu.equipment_management_system.pojo.vo.out.information_list.damage.EquipmentDamageBasicVo;
import edu.lsnu.equipment_management_system.pojo.vo.out.information_list.repair.EquipmentRepairVo;
import edu.lsnu.equipment_management_system.pojo.vo.out.information_list.transfer_out.EquipmentTransferOutBasicVo;
import edu.lsnu.equipment_management_system.pojo.vo.out.information_list.used_using.DeviceVo;
import edu.lsnu.equipment_management_system.pojo.vo.out.information_list.used_using.EquipmentVo;
import edu.lsnu.equipment_management_system.pojo.vo.out.session.UserVo;
import edu.lsnu.equipment_management_system.pojo.vo.sql_conditions.PageBeginAndPageSizeVo;
import edu.lsnu.equipment_management_system.pojo.vo.sql_conditions.PageBeginPageSizeAndEquipmentNoVo;
import edu.lsnu.equipment_management_system.pojo.vo.sql_conditions.PageBeginPageSizeAndUserNoVo;
import edu.lsnu.equipment_management_system.service.EquipmentInformationService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @author mzy
 * @Description
 * @date 2018/11/24
 */
@Service
// 将page.size注入进来
@Data
@PropertySource({"classpath:resource.properties"})
@ConfigurationProperties(prefix = "page.user")
public class EquipmentInformationServiceImpl implements EquipmentInformationService {
    private Integer size;

    @Autowired
    PowerCheckMapper powerCheckMapper;

    @Autowired
    EquipmentInformationMapperWithPaging equipmentInformationMapperWithPaging;

    /**
     * @Description 管理员：获得所有设备的基本信息列表
     * @author mzy
     * @time 2018-11-24
     * @see 
     * @return   edu.lsnu.equipment_management_system.pojo.domain.PageBean<edu.lsnu.equipment_management_system.pojo.vo.out.information_list.used_using.DeviceVo>
     * @params  [currentPage]
     */
    @Override
    public PageBean<DeviceVo> getAdminAllEquipmentBasicInformationVo(Integer currentPage) {
        // 获得总count
        Integer count = equipmentInformationMapperWithPaging.getAdminAllEquipmentBasicInformationVoCount();
        // 构造pageBean
        PageBean<DeviceVo> pageBeanContain = new PageBean<>();

        PageBean<DeviceVo> pageBean = (PageBean<DeviceVo>) PageBeanDeal.getPageBean(count, currentPage, this.size, pageBeanContain);


        // 查询当前页的List。
        PageBeginAndPageSizeVo pageBeginAndPageSizeVo = new PageBeginAndPageSizeVo();
        // 当前页开始的条数：(当前页 - 1) * 页容量
        Integer pageBegin = (pageBean.getCurrentPage() - 1)*pageBean.getPageSize();
        pageBeginAndPageSizeVo.setPageBegin(pageBegin);
        pageBeginAndPageSizeVo.setPageSize(pageBean.getPageSize());
        List<DeviceVo> adminAllEquipmentBasicInformationVo =
                equipmentInformationMapperWithPaging.getAdminAllEquipmentBasicInformationVo(pageBeginAndPageSizeVo);

        pageBean.setContent(adminAllEquipmentBasicInformationVo);

        return pageBean;
    }
    
    /**
     * @Description 新增管理员查询所有的在用设备的列表
     * @author mzywucai
     * @time 2019-01-04
     * @see 
     * @return   edu.lsnu.equipment_management_system.pojo.domain.PageBean<edu.lsnu.equipment_management_system.pojo.vo.out.information_list.used_using.DeviceVo>
     * @params  [currentPage]
     */
    @Override
    public PageBean<DeviceVo> getAdminUsingEquipmentBasicInformationVo(Integer currentPage) {
        // 获得总count
        Integer count = equipmentInformationMapperWithPaging.getAdminUsingEquipmentBasicInformationVoCount();
        // 构造pageBean
        PageBean<DeviceVo> pageBeanContain = new PageBean<>();

        PageBean<DeviceVo> pageBean = (PageBean<DeviceVo>) PageBeanDeal.getPageBean(count, currentPage, this.size, pageBeanContain);


        // 查询当前页的List。
        PageBeginAndPageSizeVo pageBeginAndPageSizeVo = new PageBeginAndPageSizeVo();
        // 当前页开始的条数：(当前页 - 1) * 页容量
        Integer pageBegin = (pageBean.getCurrentPage() - 1)*pageBean.getPageSize();
        pageBeginAndPageSizeVo.setPageBegin(pageBegin);
        pageBeginAndPageSizeVo.setPageSize(pageBean.getPageSize());
        List<DeviceVo> adminUsingEquipmentBasicInformationVo =
                equipmentInformationMapperWithPaging.getAdminUsingEquipmentBasicInformationVo(pageBeginAndPageSizeVo);

        pageBean.setContent(adminUsingEquipmentBasicInformationVo);

        return pageBean;
    }

    /**
     * @Description 新增管理员查询所有的调出设备的列表
     * @author mzywucai
     * @time 2019-01-04
     * @see 
     * @return   edu.lsnu.equipment_management_system.pojo.domain.PageBean<edu.lsnu.equipment_management_system.pojo.vo.out.information_list.used_using.DeviceVo>
     * @params  [currentPage]
     */
    @Override
    public PageBean<EquipmentTransferOutBasicVo> getAdminTransferOutEquipmentBasicInformationVo(Integer currentPage) {
        // 获得总count
        Integer count = equipmentInformationMapperWithPaging.getAdminTransferOutEquipmentBasicInformationVoCount();
        // 构造pageBean
        PageBean<EquipmentTransferOutBasicVo> pageBeanContain = new PageBean<>();

        PageBean<EquipmentTransferOutBasicVo> pageBean = (PageBean<EquipmentTransferOutBasicVo>) PageBeanDeal.getPageBean(count, currentPage, this.size, pageBeanContain);

        // 查询当前页的List。
        PageBeginAndPageSizeVo pageBeginAndPageSizeVo = new PageBeginAndPageSizeVo();
        // 当前页开始的条数：(当前页 - 1) * 页容量
        Integer pageBegin = (pageBean.getCurrentPage() - 1)*pageBean.getPageSize();
        pageBeginAndPageSizeVo.setPageBegin(pageBegin);
        pageBeginAndPageSizeVo.setPageSize(pageBean.getPageSize());

        List<EquipmentTransferOutBasicVo> adminTransferOutEquipmentBasicInformationVo =
                equipmentInformationMapperWithPaging.getAdminTransferOutEquipmentBasicInformationVo(pageBeginAndPageSizeVo);

        pageBean.setContent(adminTransferOutEquipmentBasicInformationVo);

        return pageBean;
    }

    /**
     * @Description 新增管理员查询所有的损毁设备的列表
     * @author mzywucai
     * @time 2019-01-04
     * @see
     * @return   edu.lsnu.equipment_management_system.pojo.domain.PageBean<edu.lsnu.equipment_management_system.pojo.vo.out.information_list.used_using.DeviceVo>
     * @params  [currentPage]
     */
    @Override
    public PageBean<EquipmentDamageBasicVo> getAdminDamageEquipmentBasicInformationVo(Integer currentPage) {
        // 获得总count
        Integer count = equipmentInformationMapperWithPaging.getAdminDamageEquipmentBasicInformationVoCount();
        // 构造pageBean
        PageBean<EquipmentDamageBasicVo> pageBeanContain = new PageBean<>();

        PageBean<EquipmentDamageBasicVo> pageBean = (PageBean<EquipmentDamageBasicVo>) PageBeanDeal.getPageBean(count, currentPage, this.size, pageBeanContain);

        // 查询当前页的List。
        PageBeginAndPageSizeVo pageBeginAndPageSizeVo = new PageBeginAndPageSizeVo();
        // 当前页开始的条数：(当前页 - 1) * 页容量
        Integer pageBegin = (pageBean.getCurrentPage() - 1)*pageBean.getPageSize();
        pageBeginAndPageSizeVo.setPageBegin(pageBegin);
        pageBeginAndPageSizeVo.setPageSize(pageBean.getPageSize());

        List<EquipmentDamageBasicVo> adminDamageEquipmentBasicInformationVo =
                equipmentInformationMapperWithPaging.getAdminDamageEquipmentBasicInformationVo(pageBeginAndPageSizeVo);

        pageBean.setContent(adminDamageEquipmentBasicInformationVo);

        return pageBean;
    }

    /**
     * @Description 获取一个普通用户使用过的设备的简略信息
     * @author mzy
     * @time 2018-11-24
     * @see 
     * @return   edu.lsnu.equipment_management_system.pojo.domain.PageBean<edu.lsnu.equipment_management_system.pojo.vo.out.information_list.used_using.DeviceVo>
     * @params  [currentPage, userNo]
     */
    @Override
    public PageBean<DeviceVo> getUserUsedEquipmentBasicInformationVo(Integer currentPage, String userNo) {
        // 获得总count
        Integer count = equipmentInformationMapperWithPaging.getUserUsedEquipmentBasicInformationVoCount(userNo);
        // 构造pageBean
        PageBean<DeviceVo> pageBeanContain = new PageBean<>();

        PageBean<DeviceVo> pageBean = (PageBean<DeviceVo>) PageBeanDeal.getPageBean(count, currentPage, this.size, pageBeanContain);

        // 查询当前页的List。
        PageBeginPageSizeAndUserNoVo pageBeginPageSizeAndUserNoVo = new PageBeginPageSizeAndUserNoVo();
        // 当前页开始的条数：(当前页 - 1) * 页容量
        Integer pageBegin = (pageBean.getCurrentPage() - 1)*pageBean.getPageSize();
        pageBeginPageSizeAndUserNoVo.setPageBegin(pageBegin);
        pageBeginPageSizeAndUserNoVo.setPageSize(pageBean.getPageSize());
        pageBeginPageSizeAndUserNoVo.setUserNo(userNo);

        List<DeviceVo> userUsedEquipmentBasicInformationVo =
                equipmentInformationMapperWithPaging.getUserUsedEquipmentBasicInformationVo(pageBeginPageSizeAndUserNoVo);

        pageBean.setContent(userUsedEquipmentBasicInformationVo);

        return pageBean;
    }

    /**
     * @Description 获取一个普通用户正在使用的设备的简略信息(管理员用户所有在用设备)
     * @author mzy
     * @time 2018-11-24
     * @see
     * @return   edu.lsnu.equipment_management_system.pojo.domain.PageBean<edu.lsnu.equipment_management_system.pojo.vo.out.information_list.used_using.DeviceVo>
     * @params  [currentPage, userNo]
     */
    @Override
    public PageBean<DeviceVo> getUserUsingEquipmentBasicInformationVo(Integer currentPage, String userNo) {
        PageBean<DeviceVo> pageBean;

        // 获得总count
        Integer count = equipmentInformationMapperWithPaging.getUserUsingEquipmentBasicInformationVoCount(userNo);
        // 构造pageBean
        PageBean<DeviceVo> pageBeanContain = new PageBean<>();

        pageBean = (PageBean<DeviceVo>) PageBeanDeal.getPageBean(count, currentPage, this.size, pageBeanContain);

        // 查询当前页的List。
        PageBeginPageSizeAndUserNoVo pageBeginPageSizeAndUserNoVo = new PageBeginPageSizeAndUserNoVo();
        // 当前页开始的条数：(当前页 - 1) * 页容量
        Integer pageBegin = (pageBean.getCurrentPage() - 1)*pageBean.getPageSize();
        pageBeginPageSizeAndUserNoVo.setPageBegin(pageBegin);
        pageBeginPageSizeAndUserNoVo.setPageSize(pageBean.getPageSize());
        pageBeginPageSizeAndUserNoVo.setUserNo(userNo);

        List<DeviceVo> userUsingEquipmentBasicInformationVo =
                equipmentInformationMapperWithPaging.getUserUsingEquipmentBasicInformationVo(pageBeginPageSizeAndUserNoVo);

        pageBean.setContent(userUsingEquipmentBasicInformationVo);


        return pageBean;
    }

    /**
     * @Description 获取一个普通用户经手报损报废的设备(管理员用户，所有报损报废设备)
     * @author mzy
     * @time 2018-11-24
     * @see
     * @return   edu.lsnu.equipment_management_system.pojo.domain.PageBean<edu.lsnu.equipment_management_system.pojo.vo.out.information_list.damage.EquipmentDamageBasicVo>
     * @params  [currentPage, userNo]
     */
    @Override
    public PageBean<EquipmentDamageBasicVo> getUserDamageEquipmentBasicInformationVo(Integer currentPage, String userNo) {
        PageBean<EquipmentDamageBasicVo> pageBean;

        // 获得总count
        Integer count = equipmentInformationMapperWithPaging.getUserDamageEquipmentBasicInformationVoCount(userNo);
        // 构造pageBean
        PageBean<EquipmentDamageBasicVo> pageBeanContain = new PageBean<>();
        pageBean = (PageBean<EquipmentDamageBasicVo>) PageBeanDeal.getPageBean(count, currentPage, this.size, pageBeanContain);

        // 查询当前页的List。
        PageBeginPageSizeAndUserNoVo pageBeginPageSizeAndUserNoVo = new PageBeginPageSizeAndUserNoVo();
        // 当前页开始的条数：(当前页 - 1) * 页容量
        Integer pageBegin = (pageBean.getCurrentPage() - 1)*pageBean.getPageSize();
        pageBeginPageSizeAndUserNoVo.setPageBegin(pageBegin);
        pageBeginPageSizeAndUserNoVo.setPageSize(pageBean.getPageSize());
        pageBeginPageSizeAndUserNoVo.setUserNo(userNo);

        List<EquipmentDamageBasicVo> userDamageEquipmentBasicInformationVo =
                equipmentInformationMapperWithPaging.getUserDamageEquipmentBasicInformationVo(pageBeginPageSizeAndUserNoVo);

        pageBean.setContent(userDamageEquipmentBasicInformationVo);

        return pageBean;
    }

    /**
     * @Description 获取一个普通用户经手调出的设备
     * @author mzy
     * @time 2018-11-24
     * @see 
     * @return   edu.lsnu.equipment_management_system.pojo.domain.PageBean<edu.lsnu.equipment_management_system.pojo.vo.out.information_list.transfer_out.EquipmentTransferOutBasicVo>
     * @params  [currentPage, userNo]
     */
    @Override
    public PageBean<EquipmentTransferOutBasicVo> getUserTransferOutEquipmentBasicInformationVo(Integer currentPage, String userNo) {
        PageBean<EquipmentTransferOutBasicVo> pageBean;

        // 获得总count
        Integer count = equipmentInformationMapperWithPaging.getUserTransferOutEquipmentBasicInformationVoCount(userNo);
        // 构造pageBean
        PageBean<EquipmentTransferOutBasicVo> pageBeanContain = new PageBean<>();

        pageBean = (PageBean<EquipmentTransferOutBasicVo>) PageBeanDeal.getPageBean(count, currentPage, this.size, pageBeanContain);

        // 查询当前页的List。
        PageBeginPageSizeAndUserNoVo pageBeginPageSizeAndUserNoVo = new PageBeginPageSizeAndUserNoVo();
        // 当前页开始的条数：(当前页 - 1) * 页容量
        Integer pageBegin = (pageBean.getCurrentPage() - 1)*pageBean.getPageSize();
        pageBeginPageSizeAndUserNoVo.setPageBegin(pageBegin);
        pageBeginPageSizeAndUserNoVo.setPageSize(pageBean.getPageSize());
        pageBeginPageSizeAndUserNoVo.setUserNo(userNo);

        List<EquipmentTransferOutBasicVo> userTransferOutEquipmentBasicInformationVo =
                equipmentInformationMapperWithPaging.getUserTransferOutEquipmentBasicInformationVo(pageBeginPageSizeAndUserNoVo);

        pageBean.setContent(userTransferOutEquipmentBasicInformationVo);


        return pageBean;
    }

    /**
     * @Description 管理员直接查看当前设备的详细信息
     * @author mzy
     * @time 2018-11-24
     * @see
     * @return   edu.lsnu.equipment_management_system.pojo.vo.out.information_list.used_using.EquipmentVo
     * @params  [equipmentNo]
     */
    @Override
    public EquipmentVo adminGetEquipmentDetailInformationVo(String equipmentNo) {
        return equipmentInformationMapperWithPaging.getEquipmentDetailInformationVo(equipmentNo);
    }

    /**
     * @Description 普通用户先校验一下是否可以查看这个设备
     * @author mzy
     * @time 2018-11-24
     * @see 
     * @return   edu.lsnu.equipment_management_system.pojo.vo.out.information_list.used_using.EquipmentVo
     * @params  [equipmentNo, userNo]
     */
    @Override
    public EquipmentVo userGetEquipmentDetailInformationVo(String equipmentNo, String userNo) throws NoPowerException {
        List<String> allEquipmentNo = powerCheckMapper.getALLUsedEquipmentNo(userNo);
        boolean contains = allEquipmentNo.contains(equipmentNo);
        if (contains) {
            return equipmentInformationMapperWithPaging.getEquipmentDetailInformationVo(equipmentNo);
        } else {
            throw new NoPowerException();
        }
    }

    // -------------普通用户：获取一个设备生命周期的时候先校验是否有权限查看这个设备的生命周期-------------
    /**
     * @Description 普通用户：获取一个设备生命周期头的缩略信息
     * @author mzy
     * @time 2018-11-24
     * @see
     * @return   edu.lsnu.equipment_management_system.pojo.vo.out.information_list.used_using.DeviceVo
     * @params  [equipmentNo, userNo]
     */
    @Override
    public DeviceVo getBasicInformationInLifeCycleVo(String equipmentNo, String userNo) throws NoPowerException {
        List<String> allEquipmentNo = powerCheckMapper.getALLUsedEquipmentNo(userNo);
        boolean contains = allEquipmentNo.contains(equipmentNo);
        if (contains) {
            return equipmentInformationMapperWithPaging.getBasicInformationInLifeCycleVo(equipmentNo);
        } else {
            throw new NoPowerException();
        }
    }

    /**
     * @Description 普通用户：获取一个设备生命周期中一条条的使用记录(useRecord)
     * @author mzy
     * @time 2018-11-24
     * @see
     * @return   edu.lsnu.equipment_management_system.pojo.domain.PageBean<edu.lsnu.equipment_management_system.pojo.vo.out.information_list.UseRecordVo>
     * @params  [currentPage, equipmentNo, userNo]
     */
    @Override
    public PageBean<UseRecordVo> getUseRecordInLifeCycleVo(Integer currentPage, String equipmentNo, HttpSession session) throws NoPowerException {
        PageBean<UseRecordVo> pageBean = null;
        if (null != session.getAttribute("user")) {
            UserVo userVo = (UserVo) session.getAttribute("user");
            String userNo = userVo.getUserNo();
            List<String> allEquipmentNo = powerCheckMapper.getALLUsedEquipmentNo(userNo);
            boolean contains = allEquipmentNo.contains(equipmentNo);
            if (contains) {
                // 获得总count
                Integer count = equipmentInformationMapperWithPaging.getUseRecordInLifeCycleVoCount(equipmentNo);
                // 构造pageBean
                PageBean<UseRecordVo> pageBeanContain = new PageBean<>();

                pageBean = (PageBean<UseRecordVo>) PageBeanDeal.getPageBean(count, currentPage, this.size, pageBeanContain);

                // 查询当前页的List。
                PageBeginPageSizeAndEquipmentNoVo pageBeginPageSizeAndEquipmentNoVo = new PageBeginPageSizeAndEquipmentNoVo();
                // 当前页开始的条数：(当前页 - 1) * 页容量
                Integer pageBegin = (pageBean.getCurrentPage() - 1)*pageBean.getPageSize();
                pageBeginPageSizeAndEquipmentNoVo.setPageBegin(pageBegin);
                pageBeginPageSizeAndEquipmentNoVo.setPageSize(pageBean.getPageSize());
                pageBeginPageSizeAndEquipmentNoVo.setEquipmentNo(equipmentNo);

                List<UseRecordVo> useRecordInLifeCycleVo =
                        equipmentInformationMapperWithPaging.getUseRecordInLifeCycleVo(pageBeginPageSizeAndEquipmentNoVo);

                pageBean.setContent(useRecordInLifeCycleVo);
            } else {
                throw new NoPowerException();
            }
        }

        if (null != session.getAttribute("admin")) {
            // 获得总count
            Integer count = equipmentInformationMapperWithPaging.getUseRecordInLifeCycleVoCount(equipmentNo);
            // 构造pageBean
            PageBean<UseRecordVo> pageBeanContain = new PageBean<>();

            pageBean = (PageBean<UseRecordVo>) PageBeanDeal.getPageBean(count, currentPage, this.size, pageBeanContain);

            // 查询当前页的List。
            PageBeginPageSizeAndEquipmentNoVo pageBeginPageSizeAndEquipmentNoVo = new PageBeginPageSizeAndEquipmentNoVo();
            // 当前页开始的条数：(当前页 - 1) * 页容量
            Integer pageBegin = (pageBean.getCurrentPage() - 1)*pageBean.getPageSize();
            pageBeginPageSizeAndEquipmentNoVo.setPageBegin(pageBegin);
            pageBeginPageSizeAndEquipmentNoVo.setPageSize(pageBean.getPageSize());
            pageBeginPageSizeAndEquipmentNoVo.setEquipmentNo(equipmentNo);

            List<UseRecordVo> useRecordInLifeCycleVo =
                    equipmentInformationMapperWithPaging.getUseRecordInLifeCycleVo(pageBeginPageSizeAndEquipmentNoVo);

            pageBean.setContent(useRecordInLifeCycleVo);
        }
        return pageBean;
    }

    /**
     * @Description 已使用年限
     * @author mzy
     * @time 2018-11-24
     * @see
     * @return   java.lang.Integer
     * @params  [equipmentNo]
     */
    @Override
    public Integer getEquipmentUsedYear(String equipmentNo, String userNo) throws NoPowerException {
        List<String> allEquipmentNo = powerCheckMapper.getALLUsedEquipmentNo(userNo);

        boolean contains = allEquipmentNo.contains(equipmentNo);
        if (contains) {
            return equipmentInformationMapperWithPaging.getEquipmentUsedYear(equipmentNo);
        } else {
            throw new NoPowerException();
        }
    }

    /**
     * @Description 最低报废年限
     * @author mzy
     * @time 2018-11-24
     * @see
     * @return   java.lang.Integer
     * @params  [equipmentNo]
     */
    @Override
    public Integer getEquipmentDepreciationPeriod(String equipmentNo, String userNo) throws NoPowerException {
        List<String> allEquipmentNo = powerCheckMapper.getALLUsedEquipmentNo(userNo);
        boolean contains = allEquipmentNo.contains(equipmentNo);
        if (contains) {
            return equipmentInformationMapperWithPaging.getEquipmentDepreciationPeriod(equipmentNo);
        } else {
            throw new NoPowerException();
        }
    }

    /**
     * @Description 获得一个用户经手的所有待修设备的列表
     * @author mzy
     * @time 2018-11-24
     * @see
     * @return   edu.lsnu.equipment_management_system.pojo.domain.PageBean<edu.lsnu.equipment_management_system.pojo.vo.out.information_list.repair.EquipmentRepairVo>
     * @params  [currentPage, userNo]
     */
    @Override
    public PageBean<EquipmentRepairVo> getEquipmentRepairVo(Integer currentPage, String userNo) {
        // 获得总count
        Integer count = equipmentInformationMapperWithPaging.getEquipmentRepairVoCount(userNo);
        // 构造pageBean
        PageBean<EquipmentRepairVo> pageBeanContain = new PageBean<>();

        PageBean<EquipmentRepairVo> pageBean = (PageBean<EquipmentRepairVo>) PageBeanDeal.getPageBean(count, currentPage, this.size, pageBeanContain);

        // 查询当前页的List。
        PageBeginPageSizeAndUserNoVo pageBeginPageSizeAndUserNoVo = new PageBeginPageSizeAndUserNoVo();
        // 当前页开始的条数：(当前页 - 1) * 页容量
        Integer pageBegin = (pageBean.getCurrentPage() - 1)*pageBean.getPageSize();
        pageBeginPageSizeAndUserNoVo.setPageBegin(pageBegin);
        pageBeginPageSizeAndUserNoVo.setPageSize(pageBean.getPageSize());
        pageBeginPageSizeAndUserNoVo.setUserNo(userNo);

        List<EquipmentRepairVo> equipmentRepairVo =
                equipmentInformationMapperWithPaging.getEquipmentRepairVo(pageBeginPageSizeAndUserNoVo);

        pageBean.setContent(equipmentRepairVo);

        return pageBean;
    }

}
